<template>
	<view class="box-view">
		<navBar :title="type == 1 ? '出土情况' : (type == 2 ? '施工水泥统计' : (type == 3 ? '柴油进场统计' : ''))" goBackUrl="/pages/homePage/homePage" @goBack="navBack"></navBar>
		<view class="tabs">
			<view @click="changeTabsItem('repair-report')" :class="[active === 'repair-report' ? 'selected' : '']"
				class="tabs-item">发起填报</view>
			<view @click="changeTabsItem('fill-record-repair')" :class="[active === 'fill-record-repair' ? 'selected' : '']"
				class="tabs-item">
				<view class="point">填报记录</view>
			</view>
		</view>
		<repairReport ref="reportRef"  v-if="active==='repair-report'" :formType="type"></repairReport>
		<fill-record ref="recordRef"  v-if="active==='fill-record-repair'" :formType="type"></fill-record>
	</view>
</template>
<script>
	import repairReport from "./components/repair-report.vue";
	import fillRecord from "./components/fill-record.vue";
	// import {hkRepairPlan_list } from "@/api/HongKong/hkAttendanceSheet.js";
	export default {
		name: "report-page",
		components: {
			repairReport,
			fillRecord,
		},
		data() {
			return {
				// 当前激活的组件
				active: "repair-report",
				type:'1', // 1为出土 2为水泥 3为柴油
			}
		},
		onLoad(options) {
			this.type = options.type
			console.log(this.type, 'sha')
		},
		mounted() {
			 // this.badgeNum = await this.getBadgeNumber()
		},
		methods: {
			/** 切换tabs的页签 */
			changeTabsItem(data) {
				this.active = data;
			},
			navBack(url) {
				uni.switchTab({
					url: url
				})
			},
		}
	}
</script>

<style scoped lang="scss">
	.box-view {
		/* #ifdef MP-WEIXIN */
		padding-top: 200rpx;
		/* #endif */
	}

	.required {
		&::before {
			content: "*";
			color: #ff6a6a;
		}
	}

	.tabs {
		line-height: 50upx;
		background: #fff;
		color: #445469;
		display: flex;
		align-items: center;
		justify-content: center;
		text-align: center;
		font-size: 36upx;
		font-weight: 500;
		border-top: 15px solid #f5f7fa;
		height: 55px;

		.tabs-item {
			border-bottom: 1px solid #e1e5ed;
			padding-bottom: 8upx;
			padding-top: 48upx;
			flex: 1;
			height: 100%;
			box-sizing: border-box;
		}

		.selected {
			color: #2f80ed;
			border-color: #2f80ed;
			font-weight: 800;
		}

		.point {
			position: relative;
		}
	}

	.container {
		box-sizing: border-box;
		background: #f5f7fa;
		font-size: 32upx;
	}
</style>